<?php 
/***
    Amrita ITEWS - Copyright (C) 2009 Amrita Vishwa Vidyapeetham, Amritapuri.
                                     (http://www.amrita.edu)
    ***************************************************************************
    This file is part of the Amrita ITEWS distribution.
    Amrita ITEWS is free software; you can redistribute it and/or modify it 
    under the terms of the GNU General Public License (version 2) as published 
    by the Free Software Foundation AND MODIFIED BY the Amrita ITEWS exception.
    ***NOTE*** The exception to the GPL is included to allow you to distribute
    a combined work that includes Amrita ITEWS without being obliged to provide
    the source code for proprietary components outside of the Amrita ITEWS
    software. Amrita ITEWS is distributed in the hope that it will be useful, 
    but WITHOUT ANY WARRANTY; without even the implied warranty of 
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
    Public License for more details. You should have received a copy of the GNU
    General Public License and the Amrita ITEWS license exception along with 
    Amrita ITEWS if not then it can be viewed here: 
    http://itews.amrita.ac.in/license.html.
    
    Documentation, latest information, license and contact details are at:
    http://itews.amrita.ac.in/
 
    Amrita ITEWS source code can be found at:
    http://code.google.com/p/itews"; 
    
    The initial code-base of Amrita ITEWS was developed by Amrita Vishwa 
    Vidyapeetham as part of the project titled,\"Intelligent & Interactive 
    Telematics using Emerging Wireless Technologies for Transport Systems 
    (ITEWS)\" sponsored by Technology Information Forecasting and Assessment 
    Council (TIFAC), India.
***/
?><?php
class PointOfInterest extends AppModel {

	var $name = 'PointOfInterest';
	var $displayField = 'point_of_interest_name';
	var $validate = array(
		'id' => array(),
		'point_of_interest_code' => array(
			'required' => array("message" => "Code should not be left blank."),
			'length'   => array('min' => 4, 'max' => 10, "message" => "Code length should be between 4 and 10"),
			'pattern'  => array("message" => "Code should not contain special characters or space.", "pattern" => '/^([[:alnum:]][\-]?[_]?)+$/'),
			'unique'   => array("message" => "Code already exists."), 
		),
		'point_of_interest_name' => array(
			'required' => array("message" => "Name should not be left blank."),
			'length'   => array('min' => 4, 'max' => 20, "message" => "Name length should be between 4 and 20"),
		),
		'point_of_interest_latitude' => array(
			'required' => array("message" => "Latitude should not be left blank."),
			//'pattern'  => array("message" => "Latitude should be a nonnegative value.", "pattern" => '/^([\+\-][[:digit:]]{2}[\.][[:digit:]]{4})+$/'),
			//'pattern'  => array("message" => "Latitude should be a nonnegative value.", "pattern" => '/^([[:digit:]]+[\.]?([[:digit:]]+)?[\,][NS])+$/'),
		),
		'point_of_interest_longitude' => array(
			'required' => array("message" => "Longitude should not be left blank."),
			//'pattern'  => array("message" => "Longitude should be a nonnegative value.", "pattern" => '/^([\+\-][[:digit:]]{3}[\.][[:digit:]]{4})+$/'),
			//'pattern'  => array("message" => "Longitude should be a nonnegative value.", "pattern" => '/^([\+\-][[:digit:]]{4}[\.])+$/'),
		),
	);

}
?>